Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Why is my variable "status" showing up deprecated in my code?

Why is my variable status showing up deprecated in my code? How do you fix this? Sorry, I'm fairly knew to JavaScript.

var age = prompt("what is your age?");

if (age >= 18 && age <= 35) {
  status = "target demo";
  console.log(status);
} else {
  status = "not my audience";
  console.log(status);
}

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem arises because you are trying to use the status variable without defining it, as @epascarello pointed out; If you use the status variable without defining it, you are overwriting the Window.status[1] property, but you do not get the warning that the status variable is not defined.

As @maksymiuk stated, if you use the status variable by defining it yourself, you will write it to the status variable that you do not recognize, not the Window.status property.

var age = prompt("what is your age?");
let status;

if (age >= 18 && age <= 35) {
  status= "target demo";
  console.log(status);
} else {
  status= "not my audience";
  console.log(status);
}


1 - Window.status

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!